%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%                                                                         %
%                              Parameters                                 %
%                                                                         %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


% ---------------------------- Description -------------------------------- 

    % This script will determine the parameters of the model that are
    % invariant in the calibration process. This includes exogenously
    % calibrated parameters and parameters that will determine grids for
    % some of the routines included in the code.

    fprintf('                 <strong> Population Growth and Firm-Product Dynamics </strong>\n  ')
    fprintf('                     Michael Peters and Conor Walsh\n  ')
    fprintf('\n\n')

%--------------------------------------------------------------------------
%                        Structural Parameters                            %
%--------------------------------------------------------------------------

    % Structure that contains most of the model's parameters
    p.options = optimset('Display','off');

    % Elasticity of substitution between varieties (exogenous)
    p.s = 4;                                     

    % Curvature innovation cost for extensive innovation (exogenous)
    p.zeta = 2;  

    % Representative agent's discount rate
    p.rho = 0.0116; 

    % Tail parameter of the productivity distribution for new varieties
    p.varrho = 15;

    % Population growth rate - calibrated for the year 1980
    p.eta = 0.02; 

%--------------------------------------------------------------------------
%                        Parameters for grids                             %
%--------------------------------------------------------------------------

    % We need to create grids that will be used for the computation of the:
        
        % (a) Joint Distribution of transformed productivity and
        % productivity gaps;

        % (b) Conditional Distribution of product age given firm age and
        % the number of product that such firm has.

        % (c) Distribution of the logarithm of employment.

% ---------------------- Joint Distribution -------------------------------

    % Lower bound of the productivity grid
    p.n1 = -5;                          

    % Upper bound of the productivity grid
    p.n2 = 20;

    % Number of points in the productivity grid
    p.n3 = 5000;

    % Define the grid according to the parameters provided above
    p.qgrid = linspace(p.n1, p.n2, p.n3);

% -------------------- Conditional Distribution ---------------------------
       
    % Maximum number of products to consider (truncation)
    p.maxprods = 45;

    % Maximum number of years of age that a firm can attain
    p.maxTime = 50;

    % Each step in the age grid will represent a fraction of a year (period length)
    p.periodlength = 1/16; 
 
 % -------------------- Employment Distribution ---------------------------

    % Number of points for the grid
    p.ypoints = 2000;

    % Construct the grid according to the specifications provided
    p.yvec = linspace(-15, 40, p.ypoints);

%--------------------------------------------------------------------------
%                        Transitional Dynamics                            %
%--------------------------------------------------------------------------

    % Determine the number of years to be analyzed after the shock
    p.Years = 320;

    % Determine the period length - in practice time unit is a month
    p.yearlength = 1/12;

    % Determine the number of periods analyzed after the economy is shocked
    p.Tperiods = p.Years/p.yearlength + 1;
    p.TimeGrid = linspace(0, p.Years, p.Tperiods);



